package com.meilai.project.dto.business.intentionScheme;

import com.meilai.project.entity.media.MediaPoint;
import com.meilai.project.entity.media.MediaPointExt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Objects;

/**
 * @author xchen
 * @since 2022-02-24
 */
@Data
@ApiModel
public class MediaPointVO extends MediaPoint {
	@ApiModelProperty("AB面时，与之匹配的media_id")
	private Long pair_media_id;

	@ApiModelProperty("full_detail")
	private String full_detail;

	@Override
	public boolean equals(Object o) {
		if (this == o) return true;
		if (!(o instanceof MediaPointVO)) return false;
		return this.getId().equals(((MediaPointVO) o).getId());
	}

	@Override
	public int hashCode() {
		return Objects.hash(super.hashCode(), pair_media_id);
	}

	public static MediaPointVO parseFrom(MediaPointExt p){
	    MediaPointVO mediaPointVO = new MediaPointVO();
	    mediaPointVO.setFull_detail(p.getFull_detail());
	    mediaPointVO.setQrcode(p.getQrcode());
	    mediaPointVO.setNfc_code(p.getNfc_code());
	    mediaPointVO.setCode(p.getCode());
	    mediaPointVO.setBuilding_area_id(p.getBuilding_area_id());
	    mediaPointVO.setMedia_type_id(p.getMedia_type_id());
	    mediaPointVO.setAb_type_id(p.getAb_type_id());
	    mediaPointVO.setPic_type_id(p.getPic_type_id());
	    mediaPointVO.setLatest_audit_id(p.getLatest_audit_id());
	    mediaPointVO.setLatest_audit_extra_id(p.getLatest_audit_extra_id());
	    mediaPointVO.setBuilding_type(p.getBuilding_type());
	    mediaPointVO.setBuilding_number(p.getBuilding_number());
	    mediaPointVO.setUnit_number(p.getUnit_number());
	    mediaPointVO.setFloor(p.getFloor());
	    mediaPointVO.setDoor_number(p.getDoor_number());
	    mediaPointVO.setLocation(p.getLocation());
	    mediaPointVO.setSize_length(p.getSize_length());
	    mediaPointVO.setSize_height(p.getSize_height());
	    mediaPointVO.setRemark(p.getRemark());
	    mediaPointVO.setLat(p.getLat());
	    mediaPointVO.setLng(p.getLng());
	    mediaPointVO.setBreakdown_type(p.getBreakdown_type());
	    mediaPointVO.setStatus(p.getStatus());
	    mediaPointVO.setSort(p.getSort());
	    mediaPointVO.setCreated_at(p.getCreated_at());
	    mediaPointVO.setUpdated_at(p.getUpdated_at());
	    mediaPointVO.setDeleted_at(p.getDeleted_at());
	    mediaPointVO.setId(p.getId());
	    return mediaPointVO;
	}
}
